<%@ page language="java" import="java.sql.Statement,java.sql.ResultSet"
	pageEncoding="UTF-8"%>
<html>
<head>
<title>会员删除</title>
<link rel="stylesheet" href="css/wzys.css" />
</head>
<body>
	<%@ include file="../conn.jsp"%>
	<%
		//得到记录集	

		if ((String) session.getAttribute("admin") == null) { //防止非管理员未经登录而直接使用
			out.print("<script>alert('管理员登录后方可使用本功能！');location.href='index.jsp'</script>");
		}

		String sql;
		Statement stmt = conn.createStatement();
		String un = (String) request.getParameter("un"); //获取GET请求传参
		//out.print(un);
		ResultSet rs;

		if (un != null) {
			sql = "select * from user where username='" + un + "'";
		//	out.print(sql);
			rs = stmt.executeQuery(sql); //操作查询
		} 
		else {
			sql = "select * from user order by username asc"; //from是必须
			rs = stmt.executeQuery(sql); //选择查询
		}
	%>
	<table border="1" width="500">
		<caption>
			<span class="title">会员信息显示及会员查询管理</span>
		</caption>
		<div>
			<form method="post">
				请输入用户名：<input type="text" name="un"> <input type="submit"
					value="提交">
			</form>
		</div>
		<tr>
			<td>会员名称</td>
			<td>会员真名</td>
			<td>手机号</td>
			<td>年龄</td>
		</tr>
		<%
			while (rs.next()) {
		%>
		<tr>
			<td><%=rs.getString("username")%></td>
			<td><%=rs.getString("realname")%></td>
			<td><%=rs.getString("mobile")%></td>
			<td><%=rs.getString("age")%></td>
		</tr>
		<%
			}
		%>
		<!-- 
<td><a href="memDelete.jsp?un=Sunman"onclick="return window.confirm('Are you sure?')">删除</a></td>

 -->
	</table>

</body>
</html>